package com.shane.math
{
/////////////////////////////////////////////////
//		createRandomArray() generates a random array of intigers
//
//		createRandomArray($MaxLength:int, $MinLength, $MaxValue, $MinValue = 0)
/////////////////////////////////////////////////	
	public class RandomArray
	{
		public function RandomArray()
		{
		}
		
		public static function createRandomArray($MaxLength:int, $MinLength:int, $MaxValue:int, $MinValue:int = 0) :Array
		{
			var outputArr:Array = new Array();
			// determine legnth of array
			var arrLength:int = Math.round(($MaxLength - $MinLength)*Math.random() ) + $MinLength;
			
			// randomly generate number values for array
			for(var i:int = 0; i < arrLength; i++) {
				var doPush:Boolean = true;
				var arrItem:int = Math.round(($MaxValue - $MinValue)*Math.random() ) + $MinValue;
				
				for(var key:String in  outputArr) {
					if(outputArr[key] == arrItem)
						doPush = false;
				}
				if(doPush)
					outputArr.push(arrItem);
			}
			return(outputArr);
		}
	}
}